package com.product.rocketmq;

import com.common.Message.vo.OperationLogMessage;
import com.common.RocketMqConstant;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 * @Author 曲冠华
 * @Date 2024/6/21
 */
@Slf4j
@Component
@RocketMQMessageListener(
        topic = RocketMqConstant.OPERATION_LOG_TOPIC,
        consumerGroup = RocketMqConstant.OPERATION_LOG_GROUP,
        selectorExpression = RocketMqConstant.OPERATION_LOG_TAG,
        // 指定消费者线程数，默认64，生产中请注意配置，避免过大或者过小
        consumeThreadMax = 5
)
public class OperationLogListener extends BaseMqMessageListener<OperationLogMessage>
        implements RocketMQListener<OperationLogMessage> {



    @Override
    protected String consumerName() {
        return RocketMqConstant.OPERATION_LOG_GROUP;
    }

    @Override
    protected void handleMessage(OperationLogMessage message) throws Exception {
        //记录操作日志


    }

    @Override
    protected void overMaxRetryTimesMessage(OperationLogMessage message) {

    }

    @Override
    protected boolean isRetry() {
        return false;
    }

    @Override
    protected boolean isThrowException() {
        return false;
    }

    @Override
    public void onMessage(OperationLogMessage operationLogMessage) {
        super.dispatchMessage(operationLogMessage);

    }
}
